package controllers

import (
	"ssims/pkg/app"
	"ssims/pkg/e"
	"ssims/services"

	"github.com/gin-gonic/gin"
	"github.com/unknwon/com"
)

func GetPeople1(c *gin.Context) {
	page := -1
	if arg := c.Query("page"); arg != "" {
		page = com.StrTo(arg).MustInt()
	}
	limit := -1
	if arg := c.Query("limit"); arg != "" {
		limit = com.StrTo(arg).MustInt()
	}
	searchId := ""
	if arg := c.Query("searchId"); arg != "" {
		searchId = arg
	}
	supplierParam := map[string]interface{}{
		"page":     page,
		"limit":    limit,
		"searchId": searchId,
	}
	err, info, total := services.GetAllPeople1(supplierParam)
	if err != nil {
		app.Error(c, e.ERROR, err, err.Error())
		return
	}
	app.OK(c, map[string]interface{}{"value": info, "total": total}, "查询成功")
}
